//Page Object
import { request } from '../../request/index'
Page({
  data: {
    cateList: [],
    swipreList: [],
    floorList:[]
  },
  //options(Object)
  onLoad: function (options) {
    // wx.request({
    //   url: 'https://api-hmugo-web.itheima.net/api/public/v1/home/catitems',
    //   success: (result)=>{
    //     console.log(result.data.message)
    //     this.setData({
    //       navList:result.data.message
    //     })
    //   },
    // });
    this.getSwipreList()
    this.getCateList()
    this.getFloorList()
  },
  // 导航组件
  getCateList() {
    request({ url: "/home/catitems" })
    .then(result => {
      this.setData({
        cateList: result.data.message
      })
    })
  },
  // 轮播图
  getSwipreList() {
    request({ url: "/home/swiperdata" })
    .then(result => {
      this.setData({
        swipreList: result.data.message
      })
    })
  },
  // 楼层
  getFloorList() {
    request({ url: "/home/floordata" })
    .then(result => {
      this.setData({
        floorList: result.data.message
      })
    })
  }
});
